
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, maximum-scale=1">
    <title>页面标题</title>

    <link rel="shortcut icon" href="/static/img/favicon.ico"/>

    <!-- 图标   -->
    <link rel="stylesheet" href="/static/plugs/awesome/css/font-awesome.min.css?ver=210714">

    <!--jquery-->
    <script src="/static/js/jquery-3.3.1.min.js"></script>


    <!--bootstrap-->
    <link href="/static/js/bootstrap-4.1.3/css/bootstrap.css" rel="stylesheet">
    <script src="/static/js/bootstrap-4.1.3/js/bootstrap.js"></script>

    <!-- bootstrap-table -->
    <link rel="stylesheet" href="/static/js/bootstrap-table-1.12.1/bootstrap-table.min.css">
    <script src="/static/js/bootstrap-table-1.12.1/bootstrap-table.min.js"></script>
    <script src="/static/js/bootstrap-table-1.12.1/bootstrap-table-zh-CN.js"></script>


    <!-- bootstrap-select -->
    <link rel="stylesheet" href="/static/css/bootstrap-select.min.css">
    <script src="/static/js/bootstrap-select.min.js"></script>

    <!-- bootstrap-table-jump 分页跳转 -->
    <link href="/static/css/bootstrap-table-pagejump.css" rel="stylesheet">
    <script src="/static/js/bootstrap-table-pagejump.js"></script>

    <!--layer-->
    <script src="/static/js/layer-3.1.1/layer.js"></script>

    <!-- 时间控件 -->
    <link rel="stylesheet" href="/static/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css">
    <script src="/static/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script src="/static/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>

    <!-- 公共的css -->
    <link rel="stylesheet" href="/static/css/style.css?v=210714035259" media="all"/>

    <!-- 公共的js -->
    <script src="/static/js/function.js?ver=210714035259"></script>
    <script src="/static/js/frame.js?ver=210714035259"></script>
    <script src="/static/js/fs.js?ver=210714035259"></script>
    <!--    <script src="/static/js/area.js?ver=210714035259"></script>-->

    <script>window.ROOT_URL = '__PUBLIC__';</script>
    <script src="/static/vue/vue.js"></script>
    <script src="/static/js/bst.js"></script>

    <script src="/static/js/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" href="/static/js/ptimg/ptimg.css">
    <script src="/static/js/ptimg/ptimg.js"></script>
    <script src="/static/js/bsEdit.js"></script>
    <!--    <link rel="stylesheet" href="/static/js/select/select.css">-->
    <!--    <script src="/static/js/select/select.js"></script>-->
    <script src="/static/base/base.js"></script>


</head>
<style>
    body{
        height:95%;
    }
</style>
<body>
<div class="container-fluid mt-2 " id="vue">

    <div class="form" id="edit">
        <div class="form-inline col-12   form-group" style="margin:0 auto">
            <label class="col-3" for="type">类型<span style="color:red"> *</span> </label>
            <select class="form-control col-8" id="type" @change="change('type')"  v-model="type"   autocomplete="off">
                <option value="" > --请选择-- </option>
                <option value="应用系统">应用系统</option>
                <option value="集团内部控制管理">集团内部控制管理</option>
                <option value="公司制度规范">公司制度规范</option>
                <option value="常用表单模块区">常用表单模块区</option>
            </select>
        </div>
        <div class="form-inline col-12  form-group" style="margin:0 auto">
            <label class="col-3" for="name">名称<span style="color:red"> *</span> </label>
            <input type="text " class="form-control col-8" name="name"  v-model="name"   placeholder="请输入名称 "  autocomplete="off">
        </div>



        <div class="text-center mt-5">
            <button type="button" class="btn btn-info btn-cancel" @click="close"> <i class="fa fa-close"></i> 取消</button>
            <button type="button" class="btn btn-info ml-2"  @click="save"><i class="fa fa-floppy-o"></i> 保存</button>
        </div>
        <input type="hidden" value="9" id="id" />
    </div>

</div>






<script>


    //table重新加载
    var bind = ()=>{
        $("#table").bootstrapTable("refresh");
    }


    let dataVue = {};
    let editJs = [{"field":"type","name":"\u7c7b\u578b","notNull":true,"value":"\u5e38\u7528\u8868\u5355\u6a21\u5757\u533a","type":"select","option":["\u5e94\u7528\u7cfb\u7edf","\u96c6\u56e2\u5185\u90e8\u63a7\u5236\u7ba1\u7406","\u516c\u53f8\u5236\u5ea6\u89c4\u8303","\u5e38\u7528\u8868\u5355\u6a21\u5757\u533a"]},{"field":"name","name":"\u540d\u79f0","notNull":true,"value":"\u8868\u5355\u6a21\u5757\u533a"}];
    for(let k of editJs)
    {
        dataVue[k['field']] = k['value'];
    }

    let id = $("#id").val();
    //Vue初始化
    var Vue = new Vue({
        el:"#vue",
        data:dataVue,
        methods:{
            save:function()
            {
                $("[data-img]").each(function()
                {
                    var id = $(this)[0]['id'];
                    dataVue[id] = $("#"+id).val();
                })

                frame.ajax({
                    type:'post',
                    url:`edit`,
                    data:{data:dataVue,id:id}
                }).then(function(res)
                {
                    handleRes(res,'children');
                })
            },
            close:function()
            {
                layer.confirm("您确定要关闭当前窗口吗?",function()
                {
                    parent.layer.closeAll();

                })
            },
            change:function(that)
            {
                let data = {};
                let type = '';
                if(that == 'area') return;
                if(that == 'province')
                {
                    data['province'] = dataVue['province'];
                    type = 'city';
                    dataVue.city = '';
                    dataVue.area = '';
                }
                else if(that == 'city')
                {
                    data['province'] = dataVue['province'];
                    data['city'] = dataVue['city'];
                    type = 'area';
                    dataVue.area = '';

                }
                else{
                    return;
                }
                frame.ajax({
                    type:'post',
                    url:'/self/base/'+type,
                    data:data
                }).then(function(res)
                {
                    $(`#${type}`).children().remove();
                    $(`#${type}`).append('<option value=""> --请选择-- </option>');
                    for(let k of res)
                    {
                        $(`#${type}`).append(`<option value="${k}"> ${k}</option>`);
                    }
                })
            },


        }
    })


</script>

<script>
    getAllSelectOne(function()
    {
        changeOneField('status',1);
    })
    $("[data-img]").each(function()
    {
        $(this).ptimg({accept:".jpg,.jpeg,.gif,.png"});
    })


</script>
</body>
</html>